/* Custom Pantone-Inspired Color Palette */
:root {
  --transparent-yellow: #F5EFC6;
  --sceptre-red: #4D0E12;
  --cerulean-blue: #A5BCD6;
  --potting-soil: #4A2E27;
  --java-brown: #231815;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background-color: #7f7f7f;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  padding: 20px;
}

/* CARD CONTAINER */
.visualizer-card {
  background: linear-gradient(135deg, rgba(245, 239, 198, 0.45) 0%, rgba(165, 188, 214, 0.25) 100%), #ffffff;
  border: 1px solid rgba(165, 188, 214, 0.6);
  width: 100%;
  max-width: 480px;
  border-radius: 28px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  transition: max-width 0.3s ease, padding 0.3s ease;
}

.visualizer-card.expanded {
  max-width: 880px;
  background: #ffffff;
}

.hidden {
  display: none !important;
}

/* FRONT VIEW */
.card-front {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--sceptre-red);
  background: var(--transparent-yellow);
  padding: 6px 14px;
  border-radius: 16px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--java-brown);
  margin-bottom: 12px;
  line-height: 1.25;
}

.card-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--potting-soil);
  opacity: 0.9;
}

.open-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--sceptre-red);
  cursor: pointer;
  padding: 0;
  width: fit-content;
  transition: gap 0.2s ease;
}

.open-btn:hover {
  gap: 12px;
}

.open-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
}

/* EXPANDED FUNCTIONAL VIEW */
.back-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.close-icon {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--java-brown);
  cursor: pointer;
}

.expanded-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--java-brown);
  margin-bottom: 20px;
}

.action-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.select-dropdown {
  flex: 2;
  min-width: 200px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #d0e0f0;
  background: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--java-brown);
  outline: none;
}

.btn-yellow {
  background: var(--transparent-yellow);
  color: var(--java-brown);
  border: 1px solid #e2d9a3;
  border-radius: 16px;
  padding: 14px 22px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-dark {
  background: var(--sceptre-red);
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 14px 22px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

/* DISPLAY SCREEN */
.visualizer-screen {
  background: linear-gradient(135deg, #fbf8e6 0%, #e8f0f8 100%);
  border: 1px solid #d0e0f0;
  border-radius: 20px;
  padding: 24px;
  min-height: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
  overflow-x: auto;
}

/* EXPLANATION BOX STYLES */
.explanation-box {
  background: #f4f8fc;
  border: 1px solid var(--cerulean-blue);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.exp-title {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--sceptre-red);
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.exp-desc {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--potting-soil);
}

/* BAR CHART STYLES */
.bar-container {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 140px;
}

.array-bar {
  width: 36px;
  background: var(--cerulean-blue);
  border-radius: 10px 10px 0 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 6px;
}

.bar-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: #ffffff;
}

/* LINKED LIST STYLES */
.linked-list-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ll-node {
  background: #ffffff;
  border: 1.5px solid var(--cerulean-blue);
  padding: 10px 16px;
  border-radius: 14px;
  font-weight: 700;
  color: var(--java-brown);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ll-ptr {
  color: var(--sceptre-red);
  font-weight: 800;
}

/* TREE STYLES */
.tree-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tree-level {
  display: flex;
  gap: 28px;
}

.tree-node {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--transparent-yellow);
  border: 1.5px solid #e2d9a3;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
  color: var(--java-brown);
  font-size: 0.9rem;
}

.root-node {
  background: var(--cerulean-blue);
  color: #ffffff;
}

/* MATRIX STYLES */
.matrix-container {
  display: flex;
  align-items: center;
  gap: 14px;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(2, 32px);
  gap: 6px;
  background: #ffffff;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid #d0e0f0;
}

.m-cell {
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
  color: var(--java-brown);
  font-size: 0.9rem;
}

.m-op {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--sceptre-red);
}

/* FOOTER STATUS */
.card-footer {
  display: flex;
  align-items: center;
}

.status-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--potting-soil);
}
